def main(variable,file):
	try:
		with open (file) as txt:
			text=txt.read()
	except:
		print("can't search this file")
	else:
		a=len(text)
		words=text.split()
		wordsnum=len(words)
		sentence=text.count('.')
		annotation=text.count('#')	
		if variable=='a':
			return a
		elif variable=='b':
			return wordsnum
		elif variable=='c':
			return sentence
		elif variable=='d':
			return annotation
		else:
			return 0
 
  while True:
	x,y,z=input("please enter\n").split()
	if x=='wc.exe':		
		if (y=='r')|(y=='er'):
			a=extension(y,z)	
			print("result: "+str(a)+'\n')
		else:	
			b=main(y,z)
			if z==0:
				print('error\n')
			else:
				print("result: "+str(b)+'\n')
	else:
		print('error\n')

